/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package org.sbbs.base.tenant.entity;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.time.LocalDate;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;
import org.sbbs.base.jpa.entity.BaseEntity;

/**
 * <b>描述:</b><br/>
 * <br/>
 *
 * 租户实体定义
 * <p>
 * <b>创建时间:</b> 2025年1月14日 12:24:48 <br/>
 * <b>作者:</b> Mr.FDC <fdc_messenger@126.com> <br/>
 *
 * <p>
 * <b>修改记录:</b><br/>
 * <ol>
 * <li><i>........</i></li>
 * </ol>
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "t_tenant")
@Comment("租户信息记录表")
public class Tenant extends BaseEntity {

    // 唯一性的租户编码
    @Column(name = "code", length = 50, unique = true)
    @Comment("租户编码")
    private String code;

    // 租户到期时间,空置为永久
    @Column(name = "expiration_time")
    @Comment("到期时间")
    private LocalDate expirationTime;

    // 租户介绍
    @Column(name = "description",length = 1000)
    @Comment("租户介绍")
    private String description;

    // 租户名称,全名
    @Column(name = "name", length = 100)
    @Comment("租户名称")
    private String name;

    // 租户简称
    @Column(name = "abbreviation", length = 20)
    @Comment("租户简称")
    private String abbreviation;

    // 状态;0-禁用 1-启用
    @Column(name = "state")
    @Comment("状态;0-禁用 1-启用")
    private Boolean state;

    // 审核状态;[05-正常 10-待初始化结构 15-待初始化数据源 20-已撤回 25-待审核 30-已拒绝 35-已同意]
    @Column(name = "status")
    @Comment("审核状态;[05-正常 10-待初始化结构 15-待初始化数据源 20-已撤回 25-待审核 30-已拒绝 35-已同意]")
    private Integer status;

    // 统一社会信用代码
    @Column(name = "credit_code",length = 100)
    @Comment("统一社会信用代码")
    private String creditCode;

    // 联系人
    @Column(name = "contact_person", length = 50)
    @Comment("联系人")
    private String contactPerson;

    // 联系人电话
    @Column(name = "contact_phone", length = 20)
    @Comment("联系人电话")
    private String contactPhone;

    // 地址
    @Column(name = "address", length = 200)
    @Comment("地址")
    private String address;

    // 默认内置租户
    @Column(name = "readonly")
    @Comment("默认内置租户")
    private Boolean readOnly;

//        @OneToOne
//	@JoinColumn(name = "ds_id",nullable = true)
//	@Comment("DS id")
//    @OneToOne(mappedBy = "tenant", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
//    private TenantDS ds;

}
